import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import "./plugins/element.js";
import "../vue.config.js";
import 'element-ui/lib/theme-chalk/display.css';

// 全局函数及变量
import Global from "./Global.js";
Vue.use(Global);

import Axios from 'axios';
Vue.prototype.$axios = Axios;
Axios.defaults.baseURL = "http://42.194.142.165:8088/front/mi/api"

Axios.interceptors.request.use(
  config => {
    // NProgress.start()
    // window.sessionStorage.getItem('token')
    config.headers.Authorization = window.sessionStorage.getItem('token');
    return config;
  },
  error => {
    router.push({ path: "/error" });
    return Promise.reject(error);
  }
);

Vue.config.productionTip = false;

new Vue({
  router,
  render: h => h(App)
}).$mount("#app");
